<?php

Loader::using("ext::libs::restful::RESTfulClient");
Loader::using("Models::Entities::Lineas");

class LineasService extends RESTfulClient {

    public function GetAll() {
        $response = $this->call("/", "GET");
        $deserializer = $this->getDeserializer();
        return $deserializer->deserialize("Lineas", $response);
    }

    public function GetById($id) {
        $response = $this->call("/$id", "GET");
        $deserializer = $this->getDeserializer();
        return $deserializer->deserialize("Lineas", $response);
    }

    public function Update(Lineas $linea) {
        $serializer = $this->getSerializer();
        $data = $serializer->serialize($linea);
        $this->call("/{$linea->getIdLinea()}", "PUT", $data);
    }

    public function Create(Lineas $linea) {
        $serializer = $this->getSerializer();
        $data = $serializer->serialize($linea);
        $result = $this->call("/new", "POST", $data);
        return $this->getDeserializer()->deserialize("Lineas", $result);
    }

    public function Remove($id) {
        $this->call("/$id", "DELETE");
    }
    
    function GetEliminados() {
        $result = $this->call("/Eliminados");
        return $this->getDeserializer()->deserialize("Lineas", $result);
    }
    
    function Restaurar($id) {
        return $this->call("/Restaurar/$id");
    }

}

?>